<?php
namespace EApiSwoole\Config;
class Config
{
    protected $itmes = [];
    public function phpParser($configPath)
    {
        $files = scandir(rtrim($configPath, '\/'));
        $data = null;
        foreach ($files as $key => $file) {
            if ($file === '.' || $file === '..') {
                continue;
            }
            $filename = \stristr($file, ".php", true);
            $data[$filename] = include $configPath."/".$file;
        }
        $this->itmes = $data;
        return $this;
    }
    public function get($keys)
    {
        $data = $this->itmes;
        foreach (explode('.', $keys) as $key => $value) {
            $data = $data[$value];
        }
        return $data;
    }

    public function all()
    {
        return $this->itmes;
    }
}
